import gradio as gr
from sales_chatbot import SalesChatBot

def sales_chat(message, history):
    return chatBot.invoke(message)

def launch_gradio():
    demo = gr.ChatInterface(
        fn=sales_chat,
        title="销售顾问",
        chatbot=gr.Chatbot(height=600),
    )
    demo.launch(share=True, server_name="0.0.0.0")

if __name__ == '__main__':
    chatBot = SalesChatBot()
    chatBot.initialize()
    launch_gradio()